<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>摊位申请信息</title>
<%@ include file="../inc.jsp"%>

</head>

<body class="easyui-layout">

	<div data-options="region:'north',border:false"
		style="height: 80px; overflow: hidden; padding: 0px">
		<form action="" method="post" id="searchForm">
			<div style="margin-left: 10px; margin-top: 10px;">
				申请标题:&nbsp;<input class="easyui-validatebox textbox" id="name"
					name="name" maxlength="100" style="width: 160px">&nbsp;&nbsp;&nbsp;
				状态:&nbsp;<select class="easyui-combobox" id="progressStatus"
					name="progressStatus" style="width: 150px;height:22px;" data-options="height:'22px'">
					<option value="">全部</option>
					<option value="-1">撤回</option>
					<option value="0">待审核</option>
					<option value="1">审核通过</option>
					<option value="2">审核不通过</option>
				</select>&nbsp;&nbsp;&nbsp; 申请时间:&nbsp;<input class="easyui-datebox"
					id="createStartTime" name="createStartTime"></input>&nbsp;至&nbsp;<input
					class="easyui-datebox" id="createEndTime" name="createEndTime"></input>&nbsp;&nbsp;&nbsp;
				<div style="margin-top: 10px;">
					审核时间:&nbsp;<input class="easyui-datebox" id="checkStartTime"
						name="checkStartTime"></input> &nbsp;至&nbsp; <input
						class="easyui-datebox" id="checkEndTime" name="checkEndTime"></input>
					&nbsp;&nbsp;&nbsp; 经营时间:&nbsp;<input class="easyui-datebox"
						id="businessStartTime" name="businessStartTime"></input>
					&nbsp;至&nbsp; <input class="easyui-datebox" id="businessEndTime"
						name="businessEndTime"></input> &nbsp;&nbsp;&nbsp; <a
						href="javascript:void(0)" class="easyui-linkbutton"
						iconCls="icon-search" onclick="find()">查询</a>
				</div>

			</div>
		</form>
	</div>

	<div data-options="region:'center',border:false">
		<table id="dg" class="easyui-datagrid" title="摊位经营户信息列表" fit="true"
			style="width: 700px; height: 250px"
			data-options="rownumbers:true,singleSelect:true,url:'${baseUrl }/admin/boothProgress/list?myApply=1',method:'post',toolbar:'#toolbar',
			showFooter:false,pagination:true,idField:'id'">
			<thead>
				<tr>
					<th data-options="field:'progress_name',width:100,align:'center'">申请标题</th>
					<th data-options="field:'progress_desc',width:100,align:'center'">申请说明</th>
					<th
						data-options="field:'progress_status',width:130,align:'center',formatter:showStatus">状态</th>
					<th data-options="field:'create_time',width:200,align:'center'">申请时间</th>
					<th data-options="field:'creator_name',width:150,align:'center'">申请人</th>
					<th
						data-options="field:'business_start_time',width:200,align:'center'">开始经营时间</th>
					<th
						data-options="field:'business_end_time',width:200,align:'center'">结束经营时间</th>
					<th data-options="field:'check_time',width:200,align:'center'">审核时间</th>
					<th data-options="field:'check_name',width:80,align:'center'">审核人</th>
					<th data-options="field:'check_desc',width:300,align:'center'">审核说明</th>
				</tr>
			</thead>
		</table>
		<!-- 功能菜单 -->
		<div id="toolbar" style="display: none;" align="left"></div>
	</div>
	<div id="dd" class="easyui-dialog" title="缴费记录" style="width:800px;height:400px;"
	   data-options="iconCls:'icon-save',resizable:true,modal:false,closable: false,buttons:'#bb',closed:true">
	  <table id="payLogList" class="easyui-datagrid" fit="true"
			style="width: 700px; height: 250px"
			data-options="rownumbers:true,singleSelect:true,url:'${baseUrl }/admin/boothPayLog/list',method:'post',
			showFooter:false,idField:'id'">
			<thead>
				<tr>
					<th data-options="field:'booth_name',width:100,align:'center'">摊位名称</th>
					<th data-options="field:'buss_name',width:100,align:'center'">经营户名称</th>
					<th data-options="field:'pay_way',width:130,align:'center',formatter:formatPayWay">付款方式</th>
					<th data-options="field:'pay_mon',width:200,align:'center'">金额</th>
					<th data-options="field:'pay_type',width:150,align:'center',formatter:formatPayType">流水类型</th>
					<th data-options="field:'creator_name',width:80,align:'center'">操作人</th>
					<th data-options="field:'create_time',width:300,align:'center'">操作时间</th>
				</tr>
			</thead>
		</table>
	</div>
	<div id="bb" style="padding-right:20px;">
		<a href="javascript:void(0)" class="easyui-linkbutton" onclick="doClose()">关闭</a>
	</div>

</body>
<script type="text/javascript">
      const groupMenu = {
      		1: [{name: '添加',icon: 'icon-add',callFun: 'add_fun()',id:'add'}
      			,{name: '撤回',icon: 'icon-reload',callFun: 'return_fun()',id:'return'}
      			,{name: '清空条件',icon: 'icon-remove',callFun: 'reset_fun()',id:'remove'}
      			]
      }
      $(document).ready(function(){
      	//var groupType = ${sessionScope.user.group_type}
      	var btnArr = groupMenu[1]
      	$('#toolbar').html('')
      	if(btnArr && btnArr.length > 0){
      		btnArr.forEach(function(item){
      			var html = '<a href="javascript:void(0);" class="easyui-linkbutton showBtn l-btn l-btn-plain" data-options="iconCls:'+item.icon+',plain:true" onclick="'+item.callFun+'" group="" id="'+item.id+'"><span class="l-btn-left"><span class="l-btn-text '+item.icon+' l-btn-icon-left">'+item.name+'</span></span></a>';
      			$('#toolbar').append(html);
      		})
      	}
      })
      function add_fun()
      {
          var params = {
                  winId:'win_add_booth_progress',
                  title:'添加摊位申请信息',
                  width:800,
                  height:390,
                  showUrl:'${baseUrl}/admin/boothProgress/au_page',
                  refresh_fun:function(){
                      $('#dg').datagrid('reload');
                  }
                  
          };
          open_fun(params);
      }
      function return_fun(){
      	var row = $('#dg').datagrid('getSelected');
          if(!row)
          {
              $.messager.alert("提示","请选择要操作的数据！");
          }
          else
          {
              $.messager.confirm("确认","是否撤回？",function(conf){
              	if(row.progress_status != 0){
              		$.messager.alert('提示',"仅待审核状态下的可撤回！",'warning');
              		return
              	}
                  if(conf)
                  {
                      var url = "${baseUrl}/admin/boothProgress/doProgressStatus?selectId="+row.id+"&status=-1";
                      $.getJSON(url, function(json){
                          if(json.success==0){
                          	$('#dg').datagrid('reload');
                          }else{
                              showErrMsg(json);
                          }
                      });
                  }                                       
              });
          }
          
      }
      function pay_fun(){
          var row = $('#dg').datagrid('getSelected');
          if(!row){
              $.messager.alert("提示","请选择！");
          }
          else{
          	 var params = {
                       winId:'win_add_pay',
                       title:'摊位缴费',
                       width:500,
                       height:500,
                       showUrl:'${baseUrl}/admin/boothProgress/pay_page?id='+row.id,
                       refresh_fun:function(){
                           $('#dg').datagrid('reload');
                       }
                       
               };
               open_fun(params);
          }
          
      }
      function input_pay_fun(){
          var row = $('#dg').datagrid('getSelected');
          if(!row){
              $.messager.alert("提示","请选择！");
          }
          else{
          	 var params = {
                       winId:'win_add_input_pay',
                       title:'录入缴费',
                       width:800,
                       height:500,
                       showUrl:'${baseUrl}/admin/boothProgress/input_pay_page?id='+row.id+'&boothId='+row.booth_id+'&applicantId='+row.user_id,
                       refresh_fun:function(){
                           $('#dg').datagrid('reload');
                       }
                       
               };
               open_fun(params);
          }
          
      }
      function payLog_fun(){
          var row = $('#dg').datagrid('getSelected');
          if(!row)
          {
              $.messager.alert("提示","请选择！");
          }
          else
          {
        	  $('#payLogList').datagrid('load',{
      			b_id:row.booth_id,
      			o_id:row.creator_id
      			});
        	  $('#dd').dialog('open');
          }
          
      }
      function end_fun()
      {
          var row = $('#dg').datagrid('getSelected');
          if(!row)
          {
              $.messager.alert("提示","请选择！");
          }
          else
          {
             
          }
          
      }
      function check_fun()
      {
          var row = $('#dg').datagrid('getSelected');
          if(!row)
          {
              $.messager.alert("提示","请选择！");
          }
          else{
          	if(row.progress_status != 0){
          		$.messager.alert('提示',"仅待审核状态下的可进行审核！",'warning');
          		return
          	} 
          	  var params = {
                        winId:'win_check_booth_progress',
                        title:'审核摊位申请信息',
                        width:800,
                        height:390,
                        showUrl:'${baseUrl}/admin/boothProgress/check_page?id='+row.id,
                        refresh_fun:function(){
                            $('#dg').datagrid('reload');
                        }
                        
                };
                open_fun(params);
          }
          
      }
      function find(){
		$('#dg').datagrid('load',{
			progressName:$('#name').val(),
			progressStatus:$('#progressStatus').combobox('getValue'),
			createStartTime: $('#createStartTime').datebox('getValue'),
			createEndTime:$('#createStartTime').datebox('getValue'),
			checkStartTime:$('#checkStartTime').datebox('getValue'),
			checkEndTime:$('#checkEndTime').datebox('getValue'),
			businessStartTime:$('#businessStartTime').datebox('getValue'),
			businessEndTime:$('#businessEndTime').datebox('getValue'),
		});
	}
      function reset_fun(){
      	$('#searchForm').form('reset');
      	find();
      }
    	function showStatus(value,rec,index)
    	{
    		if(value==0)
    			return "<font color=''>待审核</font>";
    		else if(value == 1)
    			return "<font color='green'>审核通过</font>";
    		else if(value == 2)
    			return "<font color='red'>审核不通过</font>";
    		else if(value == -1)
    			return "<font color='#CA9A00'>已撤回</font>";
    	}
    	function formatPayType(value,rec,index)
    	{
    		if(value==1)
    			return "<font color=''>缴纳租金</font>";
    		else if(value == 2)
    			return "<font color='green'>退租</font>";
    	}
    	function formatPayWay(value,rec,index)
    	{
    		if(value==1)
    			return "<font color=''>支付宝</font>";
    		else if(value == 2)
    			return "<font color='green'>微信</font>";
    	}
    	function doClose(){
    		$('#dd').dialog('close');
    	}
	</script>
<style type="text/css">
.showBtn {
	display: inline;
}
</style>
</html>
